package com.education.mapper;

import com.education.domain.Tbgrade;
import com.education.domain.TbgradeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbgradeMapper {
    @SelectProvider(type=TbgradeSqlProvider.class, method="countByExample")
    int countByExample(TbgradeExample example);

    @DeleteProvider(type=TbgradeSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbgradeExample example);

    @Delete({
        "delete from tbgrade",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbgrade (nGrade, strGradeName)",
        "values (#{ngrade,jdbcType=INTEGER}, #{strgradename,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbgrade record);

    @InsertProvider(type=TbgradeSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbgrade record);

    @SelectProvider(type=TbgradeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="strGradeName", property="strgradename", jdbcType=JdbcType.VARCHAR)
    })
    List<Tbgrade> selectByExample(TbgradeExample example);

    @Select({
        "select",
        "lId, nGrade, strGradeName",
        "from tbgrade",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="strGradeName", property="strgradename", jdbcType=JdbcType.VARCHAR)
    })
    Tbgrade selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbgradeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbgrade record, @Param("example") TbgradeExample example);

    @UpdateProvider(type=TbgradeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbgrade record, @Param("example") TbgradeExample example);

    @UpdateProvider(type=TbgradeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbgrade record);

    @Update({
        "update tbgrade",
        "set nGrade = #{ngrade,jdbcType=INTEGER},",
          "strGradeName = #{strgradename,jdbcType=VARCHAR}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbgrade record);
}